<template>
  <div class="preview-article">
    <el-dialog title="预览文章" :visible.sync="dialogFormVisible" width="50%">
      <div class="article-title">
        <h1>{{ preArticle.title }}</h1>
        <span>{{ preArticle.createTime | dateFormat }}</span>
        <span>{{ preArticle.username }}</span>
        <span class="el-icon-view"></span>
        <span>{{ preArticle.visits }}</span>
      </div>
      <div class="article-content" v-html="preArticle.articleBody"></div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'PreviewArticle',
  props: {
    preArticle: {
      type: [Object, String],
      required: true
    }
  },
  data() {
    return {
      dialogFormVisible: false
    }
  },
  methods: {
    // 弹层显示
    dialogFormV() {
      this.dialogFormVisible = true
    }
  }
}
</script>

<style scoped lang="less">
.article-title {
  span {
    margin-right: 10px;
  }
}
/deep/.article-content {
  margin-top: 15px;
  background-color: #f5f5f5;
  border-top: 1px dashed #cccccc;
  padding: 20px;
}
</style>
